package WaiBao;

import java.util.Arrays;

public class ChenShuJie {
    public static void main(String[] args) {
        String[] mingzi = {"李雪(班长)", "陈梅(副班长)", "小李(学习委员)", "石榴(团支书)", "马磊", "叶少良", "魏倩", "钟意", "贾德佳", "谢红", "胡慧珍", "文君",
                "蕾蕾", "何国秀", "田文澜", "王泽峰", "将华宇", "刘梅", "孙亚文", "李晓梅", "杜小兰", "李小春", "李静瑶", "胡橘芳", "王波", "刘佳", "沈霞", "彭海燕",
                "沈玲玲", "陈述洁 (文艺委员)"};//考生本人: 陈述洁 (文艺委员)
        int[] nainji = {20, 19, 17, 18,18, 19, 20, 20, 19, 19,19, 20, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 20};//考生年龄：20岁
        double[] Goal1 = {76, 91, 84, 91, 81, 79, 88, 89, 77, 91, 93, 77, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 95};
        double[] Goal2 = {88, 95, 81, 66, 71, 74, 82, 89, 94, 80, 91, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 94};
        double[] Goal3 = {85, 86, 98, 85, 75, 69, 78, 89, 80, 68, 93, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};

        double a1;//代表每个学生的总分
        double b1;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            a1 = Goal1[i] + Goal2[i] +Goal3[i];
//            b1 = ( a1 * 1.0) / 3;
//            System.out.println(mingzi[i] + "的总分为:" + a1);
//            System.out.println(mingzi[i] + "的平均分为:" +b1);
//        }

        double my1 = 0, my2 = 0;
        double[] yes = new double[30];
//        for (int i = 0; i < 30; i++) {
//            my1 = Goal1[i] + Goal2[i] + Goal3[i];
//            b1 = (my1 * 1.0) / 3;
//            yes[i] = b1;
//        }
//
//        for (int i = 0; i < yes.length - 1; i++) {
//            for (int j = 0; j < yes.length - i - 1; j++) {
//                if (yes[j] < yes[j + 1]) {
//                    double tep = yes[j];
//                    yes[j] =yes[j + 1];
//                    yes[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(yes[i]);
//        }


        double t1 = 0,t2 = 0, t3 = 0;//计算每门课的平均分
        double y1 = 0,y2 = 0, y3 = 0;//计算每门课标准差
        double u1 = 0, u2 = 0,  u3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < Goal1.length; i++) {
            sum2+=Goal1[i];
        }
        t1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+t1);
        double Sum = 0;
        for (int i = 0; i < Goal2.length; i++) {
            Sum+=Goal2[i];
        }
        t2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+t2);
        double sum = 0;
        for (int i = 0; i <Goal3.length; i++) {
            sum+=Goal3[i];
        }
        t3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+t3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <Goal1.length; i++) {
            c1+= (Goal1[i] -t1)*(Goal1[i] - t1);
        }
        y1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+y1);

        for (int i = 0; i < Goal2.length; i++) {
            c2+= (Goal2[i] -t2)*(Goal2[i] -t2);
        }
        y2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+y2);

        for (int i = 0; i < Goal3.length; i++) {
            c3+= (Goal3[i] -t3)*(Goal3[i] - t3);
        }
        y3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+y3);
////
////
//        Arrays.sort(Goal1);
//        Arrays.sort(Goal2);
//        Arrays.sort(Goal3);
//        u1 =( Goal1[14]+Goal1[15])*1.0/2;
//        u2 =( Goal2[14]+Goal2[15])*1.0/2;
//        u3 =( Goal3[14]+Goal3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+ u1);
//        System.out.println("微生物学的中位数为:"+ u2);
//        System.out.println("人体组织解剖学的中位数为:"+ u3);
    }
}
